package Computer.Main;

public class Computer {
	private Memory memory;
	private Program instructions;
	private ProgramCounter counter;
	
	public Computer(Memory memory) {
		this.memory = memory;
		this.counter = new ProgramCounter();
	}
	
	public void load(Program program) {
		instructions = program;
	}
	
	public void run() {
		while(counter.hasNext()) {
			instructions.get(counter.getNextAddress()).execute(memory, counter);
		}
	}
}